<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		
	</style>
</head>
<body>

	<div id="app">
	  <p>
	    <router-link to="/user/foo">/user/foo</router-link>
	    <router-link to="/user/foo/profile">/user/foo/profile</router-link>
	    <router-link to="/user/foo/posts">/user/foo/posts</router-link>
	  </p>
	  <router-view></router-view>
	</div>
	
	<script src="node_modules/vue/dist/vue.min.js"></script>
	<script src="node_modules/vue-router/dist/vue-router.min.js"></script>
	<script>

		var User = {
			  template: `
			    <div class="user">
			      <h2>User {{ $route.params.id }}</h2>
			      <router-view></router-view>
			    </div>
			  `
		};

		var UserHome = { template: '<div>Home</div>' };
		var UserProfile = { template: '<div>Profile</div>' };
		var UserPosts = { template: '<div>Posts</div>' };

		var router = new VueRouter({
		  routes: [
		    { path: '/user/:id', component: User,
		      children: [
		        // UserHome will be rendered inside User's <router-view>
		        // when /user/:id is matched
		        { path: '', component: UserHome },
						
		        // UserProfile will be rendered inside User's <router-view>
		        // when /user/:id/profile is matched
		        { path: 'profile', component: UserProfile },

		        // UserPosts will be rendered inside User's <router-view>
		        // when /user/:id/posts is matched
		        { path: 'posts', component: UserPosts }
		      ]
		    }
		  ]
		});

		var app = new Vue({ router }).$mount('#app');

	</script>
</body>
</html>